package com.ncepu.clubmanagement.controller;

import com.ncepu.clubmanagement.pojo.Result;
import com.ncepu.clubmanagement.pojo.School;
import com.ncepu.clubmanagement.service.UniversityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/university")
public class UniversityController {

    @Autowired
    private UniversityService universityService;

    @GetMapping
    public Result getSchByName(@RequestParam String schName){
        List<School> school = universityService.getSchByName(schName);
        return Result.success(school);
    }

    @GetMapping("/all")
    public Result getAllSch(){
        List<School> school = universityService.getAllSch();
        return Result.success(school);
    }
}
